package com.skydonkey.dao;

import com.skydonkey.pojo.po.VideoSecComment;
import org.apache.ibatis.annotations.*;
import java.util.List;

@Mapper
public interface VideoSecCommentMapper {

    @Select("SELECT * FROM video_sec_comments WHERE sec_comment_id = #{secCommentId}")
    VideoSecComment findById(@Param("secCommentId") Long secCommentId);

    @Insert("INSERT INTO video_sec_comments (comment_id, uid, to_uid, content, create_time) " +
            "VALUES (#{commentId}, #{uid}, #{toUid}, #{content}, #{createTime})")
    @Options(useGeneratedKeys = true, keyProperty = "secCommentId")
    int insert(VideoSecComment videoSecComment);

    @Update("UPDATE video_sec_comments SET comment_id = #{commentId}, uid = #{uid}, to_uid = #{toUid}, " +
            "content = #{content}, create_time = #{createTime} WHERE sec_comment_id = #{secCommentId}")
    int update(VideoSecComment videoSecComment);

    @Delete("DELETE FROM video_sec_comments WHERE sec_comment_id = #{secCommentId}")
    int deleteById(@Param("secCommentId") Long secCommentId);

    @Select("SELECT * FROM video_sec_comments WHERE comment_id = #{commentId}")
    List<VideoSecComment> findByCommentId(@Param("commentId") Long commentId);

}
